/*
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-11-24 15:38:32
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-11-24 16:06:10
 * @FilePath: \WingsUpdater-main\inc\Misc.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

#pragma once
#include <string>
#include <vector>

// function declaration.

/// @brief 打印logo。
void showLogo();

/// @brief 主版本号。
int majorVersion();

/// @brief 次版本号。
int minorVersion();

/// @brief 补丁版本号。
int patchVersion();

/// @brief 打印版本信息。
void showVersion();

///@brief         get error string use errno,it is thread-safe,encapsulate with 'strerror_r'.
///@tparam        none
///@param         errNum errno in "errno.h". 
///@return        return the error string corresponding to errno if errno is known; otherwise return "unknown error".
///@deprecated    none
////
const std::string getErrorInfo(const int errNum);

///@brief         make every word in string fisrt char be capital.
///@tparam        none
///@param         words a sentence.
///@return        none
///@deprecated    none
void capitalize(std::string &words);

///@brief         trim a string with specified character.
///@tparam        none
///@param         words string to be trimed.
///@param         ch key character.
///@return        none
///@deprecated    none
void trim(std::string &words,const char ch = ' ');

///@brief         separate a string with specified key string.
///@tparam        none
///@param         words string to be separated.
///@param         key key string.
///@return        none
///@deprecated    none
std::vector<std::string> split(const std::string &words, const std::string &key = " ");

///@brief         execute shell.
///@tparam        none
///@param         cmd command string.
///@param         result shell result string.
///@return        error information in string,if empty,indicates normal,otherwise function execute failed and error string put in string.
///@deprecated    none
const std::string shell(const std::string &cmd,std::string &result);

///@brief         function reload,just no result receiver,seem as 'const std::string shell(const std::string &cmd,std::string &result)'.
///@tparam        none
///@param         cmd command string.
///@return        error information in string,if empty,indicates normal,otherwise function execute failed and error string put in string.
///@deprecated    none
const std::string shell(const std::string &cmd);

/// @brief get current application execution path.
/// @return empty std::string means failed; otherwise, means success.
std::string executionPath();

///@brief         get specified network device's ip v4 address
///@tparam        none
///@param         ifaceName name of network device.
///@return        returned ip v4 addr string if executed success; otherwise, returned empty string.
///@deprecated    none
std::string ipV4Addr(const std::string &ifaceName = "eth0");

///@brief         determine whether the passwd string'ipStr' is a ip v4 address string.
///@tparam        none
///@param         ipStr ip address string to be determine.
///@return        true: 'ipStr' is a ip v4 address string; or returned false.
///@deprecated    none
bool isIpV4Addr(const std::string &ipStr);
